package com.cheejee.goodscenter.module.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.cheejee.goodscenter.validated.InsertGroup;
import com.cheejee.goodscenter.validated.UpdateGroup;

public class GoodsSpecific {

	@NotNull(message = "商品规格ID不能为空", groups = { UpdateGroup.class })
	private Long id;

	@NotNull(message = "商品ID不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	private Long goodsId;

	@NotBlank(message = "商品规格名不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	@Length(max = 200, message = "商品规格名称长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
	private String specificName;

	@NotBlank(message = "商品规格值不能为空", groups = { UpdateGroup.class, InsertGroup.class })
	@Length(max = 200, message = "商品规格值长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
	private String specificValue;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Long goodsId) {
		this.goodsId = goodsId;
	}

	public String getSpecificName() {
		return specificName;
	}

	public void setSpecificName(String specificName) {
		this.specificName = specificName == null ? null : specificName.trim();
	}

	public String getSpecificValue() {
		return specificValue;
	}

	public void setSpecificValue(String specificValue) {
		this.specificValue = specificValue == null ? null : specificValue.trim();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", goodsId=").append(goodsId);
		sb.append(", specificName=").append(specificName);
		sb.append(", specificValue=").append(specificValue);
		sb.append("]");
		return sb.toString();
	}
}